package com.agentfactory.teleoreactive.compiler;
import java.util.List;

public class IncludesVisitor implements TeleoReactiveParserVisitor {

	@SuppressWarnings("unchecked")
	@Override
	public Object visit(SimpleNode node, Object data) {
		if (node.toString().equals("IncludeExpression")) {
			List<String> imports = (List<String>) data;
			String i = (String) ((SimpleNode) node.jjtGetChild(0)).jjtGetValue();
			if (!imports.contains(i)) imports.add(i);
		} else {
			for (int i=0; i<node.jjtGetNumChildren(); i++) {
				visit((SimpleNode) node.jjtGetChild(i), data);
			}
		}
		return null;
	}

}
